<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <title>Rails::Info</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <link rel="stylesheet" href="../../css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../css/main.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../css/github.css" type="text/css" media="screen" />
<script src="../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/main.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/highlight.pack.js" type="text/javascript" charset="utf-8"></script>

</head>

<body>     
    <div class="banner">
        
            <span>Ruby on Rails v4.0.0</span><br />
        
        <h1>
            <span class="type">Module</span> 
            Rails::Info 
            
        </h1>
        <ul class="files">
            
            <li><a href="../../files/railties/lib/rails/info_rb.html">railties/lib/rails/info.rb</a></li>
            
        </ul>
    </div>
    <div id="bodyContent">
        <div id="content">
  


  


  
  


  


  
    <!-- Method ref -->
    <div class="sectiontitle">Methods</div>
    <dl class="methods">
      
        <dt>F</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="Info.html#method-c-framework_version">framework_version</a>,
              </li>
            
              
              <li>
                <a href="Info.html#method-c-frameworks">frameworks</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>I</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="Info.html#method-c-inspect">inspect</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>P</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="Info.html#method-c-property">property</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>T</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="Info.html#method-c-to_html">to_html</a>,
              </li>
            
              
              <li>
                <a href="Info.html#method-c-to_s">to_s</a>
              </li>
            
          </ul>
        </dd>
      
    </dl>
  

  



  

    

    

    


    


    <!-- Methods -->
    
      <div class="sectiontitle">Class Public methods</div>
      
        <div class="method">
          <div class="title method-title" id="method-c-framework_version">
            
              <b>framework_version</b>(framework)
            
            <a href="Info.html#method-c-framework_version" name="method-c-framework_version" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-c-framework_version_source')" id="l_method-c-framework_version_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/f0e6ab59f681cb400043d51cb259fbd84920df09/railties/lib/rails/info.rb#L29" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-c-framework_version_source" class="dyn-source">
                <pre><span class="ruby-comment"># File railties/lib/rails/info.rb, line 29</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">framework_version</span>(<span class="ruby-identifier">framework</span>)
  <span class="ruby-keyword">if</span> <span class="ruby-constant">Object</span>.<span class="ruby-identifier">const_defined?</span>(<span class="ruby-identifier">framework</span>.<span class="ruby-identifier">classify</span>)
    <span class="ruby-identifier">require</span> <span class="ruby-node">&quot;#{framework}/version&quot;</span>
    <span class="ruby-identifier">framework</span>.<span class="ruby-identifier">classify</span>.<span class="ruby-identifier">constantize</span>.<span class="ruby-identifier">version</span>.<span class="ruby-identifier">to_s</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-c-frameworks">
            
              <b>frameworks</b>()
            
            <a href="Info.html#method-c-frameworks" name="method-c-frameworks" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-c-frameworks_source')" id="l_method-c-frameworks_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/f0e6ab59f681cb400043d51cb259fbd84920df09/railties/lib/rails/info.rb#L25" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-c-frameworks_source" class="dyn-source">
                <pre><span class="ruby-comment"># File railties/lib/rails/info.rb, line 25</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">frameworks</span>
  <span class="ruby-node">%w( active_record action_pack action_mailer active_support )</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-c-inspect">
            
              <b>inspect</b>()
            
            <a href="Info.html#method-c-inspect" name="method-c-inspect" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-c-property">
            
              <b>property</b>(name, value = nil)
            
            <a href="Info.html#method-c-property" name="method-c-property" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-c-property_source')" id="l_method-c-property_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/f0e6ab59f681cb400043d51cb259fbd84920df09/railties/lib/rails/info.rb#L19" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-c-property_source" class="dyn-source">
                <pre><span class="ruby-comment"># File railties/lib/rails/info.rb, line 19</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">property</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">value</span> = <span class="ruby-keyword">nil</span>)
  <span class="ruby-identifier">value</span> <span class="ruby-operator">||=</span> <span class="ruby-keyword">yield</span>
  <span class="ruby-identifier">properties</span> <span class="ruby-operator">&lt;&lt;</span> [<span class="ruby-identifier">name</span>, <span class="ruby-identifier">value</span>] <span class="ruby-keyword">if</span> <span class="ruby-identifier">value</span>
<span class="ruby-keyword">rescue</span> <span class="ruby-constant">Exception</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-c-to_html">
            
              <b>to_html</b>()
            
            <a href="Info.html#method-c-to_html" name="method-c-to_html" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-c-to_html_source')" id="l_method-c-to_html_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/f0e6ab59f681cb400043d51cb259fbd84920df09/railties/lib/rails/info.rb#L48" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-c-to_html_source" class="dyn-source">
                <pre><span class="ruby-comment"># File railties/lib/rails/info.rb, line 48</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">to_html</span>
  <span class="ruby-string">'&lt;table&gt;'</span>.<span class="ruby-identifier">tap</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">table</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">properties</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">value</span>)<span class="ruby-operator">|</span>
      <span class="ruby-identifier">table</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">%Q(&lt;tr&gt;&lt;td class=&quot;name&quot;&gt;#{CGI.escapeHTML(name.to_s)}&lt;/td&gt;)</span>
      <span class="ruby-identifier">formatted_value</span> = <span class="ruby-keyword">if</span> <span class="ruby-identifier">value</span>.<span class="ruby-identifier">kind_of?</span>(<span class="ruby-constant">Array</span>)
            <span class="ruby-string">&quot;&lt;ul&gt;&quot;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">value</span>.<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-node">&quot;&lt;li&gt;#{CGI.escapeHTML(v.to_s)}&lt;/li&gt;&quot;</span> }.<span class="ruby-identifier">join</span> <span class="ruby-operator">+</span> <span class="ruby-string">&quot;&lt;/ul&gt;&quot;</span>
          <span class="ruby-keyword">else</span>
            <span class="ruby-constant">CGI</span>.<span class="ruby-identifier">escapeHTML</span>(<span class="ruby-identifier">value</span>.<span class="ruby-identifier">to_s</span>)
          <span class="ruby-keyword">end</span>
      <span class="ruby-identifier">table</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">%Q(&lt;td class=&quot;value&quot;&gt;#{formatted_value}&lt;/td&gt;&lt;/tr&gt;)</span>
    <span class="ruby-keyword">end</span>
    <span class="ruby-identifier">table</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-string">'&lt;/table&gt;'</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-c-to_s">
            
              <b>to_s</b>()
            
            <a href="Info.html#method-c-to_s" name="method-c-to_s" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
            <div class="aka">
              Also aliased as: <a href="Info.html#method-c-inspect">inspect</a>
            </div>
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-c-to_s_source')" id="l_method-c-to_s_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/f0e6ab59f681cb400043d51cb259fbd84920df09/railties/lib/rails/info.rb#L36" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-c-to_s_source" class="dyn-source">
                <pre><span class="ruby-comment"># File railties/lib/rails/info.rb, line 36</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">to_s</span>
  <span class="ruby-identifier">column_width</span> = <span class="ruby-identifier">properties</span>.<span class="ruby-identifier">names</span>.<span class="ruby-identifier">map</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">name</span><span class="ruby-operator">|</span> <span class="ruby-identifier">name</span>.<span class="ruby-identifier">length</span>}.<span class="ruby-identifier">max</span>
  <span class="ruby-identifier">info</span> = <span class="ruby-identifier">properties</span>.<span class="ruby-identifier">map</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">name</span>, <span class="ruby-identifier">value</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">value</span> = <span class="ruby-identifier">value</span>.<span class="ruby-identifier">join</span>(<span class="ruby-string">&quot;, &quot;</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">value</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Array</span>)
    <span class="ruby-node">&quot;%-#{column_width}s   %s&quot;</span> <span class="ruby-operator">%</span> [<span class="ruby-identifier">name</span>, <span class="ruby-identifier">value</span>]
  <span class="ruby-keyword">end</span>
  <span class="ruby-identifier">info</span>.<span class="ruby-identifier">unshift</span> <span class="ruby-string">&quot;About your application's environment&quot;</span>
  <span class="ruby-identifier">info</span> * <span class="ruby-string">&quot;\n&quot;</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
                        </div>

    </div>
  </body>
</html>    